package io.github.biezhi.elves.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import io.github.biezhi.elves.mapper.CompMapper;
import io.github.biezhi.elves.model.CompBasic;
import io.github.biezhi.elves.model.QccCookie;
import io.github.biezhi.elves.service.CompService;

@Service("compService")
public class CompServiceImpl implements CompService {
	@Autowired
	private CompMapper compMapper;
	
	/**
	 * 查询企业表已更新logo数量数
	 * @param cityId
	 * @return
	 */
	public int countCompBasicUpdateLogo(Integer cityId) {
		return this.compMapper.countCompBasicUpdateLogo(cityId);
	}
	
	/**
	 * 根据企业名称和地市ID批量更新企业地址、logo、简介
	 * @param cityId
	 * @return
	 */
	public Page<CompBasic> listCompBasicPageByCityId(int pageNo, int pageSize,Integer cityId) {
		PageHelper.startPage(pageNo, pageSize);
		return this.compMapper.listCompBasicPageByCityId(cityId);
	}
	
	/**
	 * 根据企业名称和地市ID批量更新企业地址、logo、简介
	 * @param compName
	 * @return
	 */
	public void updateCompBasicData(CompBasic compBasic) {
		this.compMapper.updateCompBasicData(compBasic);
	}
	
	/**
	 * 查询企查查没有使用过的账户cookie数据
	 * @return
	 */
	public QccCookie findQccCookie() {
		return this.compMapper.findQccCookie();
	}
	
	/**
	 * 根据id更新使用企查查账户cookie数据(更新is_use字段值为T)
	 * @param qccId
	 */
	public void updateQccCookieIsUse(Integer qccId) {
		this.compMapper.updateQccCookieIsUse(qccId);
	}
}